package common05.common;

public final class Token {

    /*jwt 过期时间七天 毫秒数*/
    public static final long LOGIN_EXPIRY_MILLIS_NUM = 1000L * 60 * 60 * 24 * 7;

    /*token header 名字*/
    public static final String TOKEN_NAME = "Authorization";

    /*jwt iss 固定值*/
    public static final String JWT_ISS = "self";

    /*token header 值 固定前缀*/
    public static final String JWT_PREFIX = "Bearer ";


    /*jwt为null或者错误或者过期*/
    public static final String JWT_NULL_OR_ERROR = "JWT_NULL_OR_ERROR";

    /*用户无权访问*/
    public static final String JWT_USER_SCOPE_ERROR = "JWT_USER_SCOPE_ERROR";

    /*用户token完全正确*/
    public static final String JWT_SUCCESS = "JWT_SUCCESS";


    /*未登录就可以访问的url*/
    public static final String[] JWT_PERMIT_ALL_URL = {"/user/login/**"};

    /*未登录就可以访问的url 前缀*/
    public static final String[] JWT_PERMIT_ALL_URL_PREFIX = {"/user/login"};


    /*token redis key名字*/
    public static String getTokenRedisKey(Long userId) {
        return "USER_TOKEN_" + userId;
    }

    /*token redis key名字*/
    public static String getTokenRedisKey(String userId) {
        return "USER_TOKEN_" + userId;
    }

}
